package com.heying.springcore.story;

public class Student {

    private String name;

    private int money;

    public Student() {
    }

    public Student(String name, int money) {
        this.name = name;
        this.money = money;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getMoney() {
        return money;
    }

    public void setMoney(int money) {
        this.money = money;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", money=" + money +
                '}';
    }
    //借出
    public void borrow(Student stu,int money){
        stu.lend(this, money);

    }

    // 借入
    public void lend(Student stu,int money){
        this.money -= money;
        stu.money += money;
    }
}
